package Sessions;

import java.util.ArrayList;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.Query;

import org.jboss.ejb3.annotation.RemoteBinding;

import EntityBeans.Abilita;
import EntityBeans.EsperienzaLavorativa;

/**
 * Session Bean implementation class ListaAbilitaSession
 */
@Stateless
@RemoteBinding(jndiBinding="ListaAbilitaRemote")
public class ListaAbilitaSession implements ListaAbilitaSessionRemote {

    /**
     * Default constructor. 
     */
	private EntityManager manager;
    public ListaAbilitaSession() {
        // TODO Auto-generated constructor stub
    }

	@Override
	public ArrayList<Abilita> getListaAbilita() {
		// TODO Auto-generated method stub
		
		String s = "FROM Abilita";
		Query query = manager.createQuery(s);
		@SuppressWarnings("unchecked")
		ArrayList<Abilita> lista_abilita = (ArrayList<Abilita>) query.getResultList();
    	if (lista_abilita.size()==0)
    		return null;
    	else return lista_abilita;
		
	}

}
